--/dbms: mssql
--/p ----------------------------
--/p Rumba for MSSQL (extend)
--/p ----------------------------

--/p ImpexIndicator
drop table ImpexIndicator
--/ignore
go
create table ImpexIndicator (
   uuid VARCHAR(255) not null,
   oca NUMERIC(19,0) not null,
   lastModified DATETIME null,
   domain VARCHAR(38) not null,
   object VARCHAR(255) not null,
   action VARCHAR(255) null,
   counterPart VARCHAR(38) null,
   lastActionTime DATETIME null,
   condTime DATETIME null,
   condId VARCHAR(128) null,
   primary key (uuid)
)
go

--/p TangoCategory
drop table TangoCategory
--/ignore
go
create table TangoCategory (
   uuid VARCHAR(38) not null,
   implementation VARCHAR(128) not null,
   oca NUMERIC(19,0) not null,
   lastModified DATETIME null,
   domain VARCHAR(38) not null,
   lastModifier VARCHAR(40) null,
   state INT null,
   catalog VARCHAR(38) not null,
   code VARCHAR(16) not null,
   name VARCHAR(50) null,
   usedType VARCHAR(50) null,
   parent VARCHAR(38) null,
   remark VARCHAR(200) null,
   primary key (uuid)
)
go
create index idx_category_1 on TangoCategory (domain, code)
go

--/p TangoDepartment
drop table TangoDepartment
--/ignore
go
create table TangoDepartment (
   uuid VARCHAR(38) not null,
   implementation VARCHAR(128) not null,
   oca NUMERIC(19,0) not null,
   lastModified DATETIME null,
   domain VARCHAR(38) null,
   lastModifier VARCHAR(255) null,
   state INT null,
   code VARCHAR(255) not null unique,
   name VARCHAR(255) null,
   remark VARCHAR(255) null,
   primary key (uuid)
)
go

--/p TQrd
drop table TQrd
--/ignore
go
create table TQrd (
   uuid VARCHAR(38) not null,
   qdName VARCHAR(255) null,
   qdTime DATETIME null,
   startTime DATETIME null,
   timeUsed NUMERIC(19,0) null,
   resultCount INT null,
   threadId NUMERIC(19,0) null,
   userUuid VARCHAR(38) null,
   queryCriteria VARBINARY(1000) null,
   displayCriteria VARBINARY(1000) null,
   message VARCHAR(1000) null,
   primary key (uuid)
)
go

--/p ImpexLog
drop table ImpexLog
--/ignore
go
create table ImpexLog (
   uuid VARCHAR(255) not null,
   oca NUMERIC(19,0) not null,
   lastModified DATETIME null,
   indicator VARCHAR(255) not null,
   curCondTime DATETIME null,
   curCondId VARCHAR(128) null,
   newCondTime DATETIME null,
   newCondId VARCHAR(128) null,
   state VARCHAR(255) null,
   startTime DATETIME null,
   endTime DATETIME null,
   commitTime DATETIME null,
   description VARCHAR(255) null,
   fileName VARCHAR(255) null,
   userFullLogin VARCHAR(255) null,
   total INT null,
   inserted INT null,
   updated INT null,
   deleted INT null,
   success INT null,
   fail INT null,
   fsize INT null,
   available INT null,
   primary key (uuid)
)
go

--/p TangoCatalog
drop table TangoCatalog
--/ignore
go
create table TangoCatalog (
   uuid VARCHAR(38) not null,
   implementation VARCHAR(128) not null,
   oca NUMERIC(19,0) not null,
   lastModified DATETIME null,
   domain VARCHAR(38) not null,
   lastModifier VARCHAR(40) null,
   state INT null,
   code VARCHAR(20) not null,
   name VARCHAR(50) null,
   itemType VARCHAR(50) not null,
   isMaster TINYINT not null,
   level1Length INT not null,
   level2Length INT not null,
   level3Length INT not null,
   level4Length INT not null,
   primary key (uuid)
)
go
create index idx_catalog_1 on TangoCatalog (domain, code)
go

--/p TCollate
drop table TCollate
--/ignore
go
create table TCollate (
   NO INT not null,
   TABLENAME VARCHAR(255) null,
   TABLELABEL VARCHAR(255) null,
   primary key (NO)
)
go

--/p TCollateItem
drop table TCollateItem
--/ignore
go
create table TCollateItem (
   COLLATENO INT not null,
   ITEMNO INT not null,
   FIELDNAME VARCHAR(255) null,
   FIELDLABEL VARCHAR(255) null,
   TYPE INT null,
   CWIDTH INT null,
   primary key (COLLATENO, ITEMNO)
)
go
